package com.chinasolf.utils;

import javax.servlet.http.HttpServletRequest;

public class AuthHeaderVaueUtils {
    //从请求头获取到token，从token获取userid
    public static Long getUserIdByHeader(HttpServletRequest request){
        //从请求头获取token
        String token = request.getHeader("token");
        //从token获取userid
        Long userId = JwtHelper.getUserId(token);
        return userId;
    }
    //从请求头获取到token，从token获取userName
    public static String getUserNameByHeader(HttpServletRequest request){
        //从请求头获取token
        String token = request.getHeader("token");
        //从token获取userid
        String userName = JwtHelper.getUserName(token);
        return userName;
    }
}
